package com.Design.Visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author Lc
 * @Date 2023/9/30
 * @PackageName: com.Design.Visitor
 * @ClassName: ObjectStructure
 * @Description:
 */

public class ObjectStructure {
    private List<Person> people = new ArrayList<Person>();

    public void add(Person person){
        people.add(person);
    }

    public void display(Action visitor){
        people.forEach(person -> {
            person.accept(visitor);
        });
    }
}

